using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using QLKS.DataLayer.BusinessObjects;
using QLKS.DataLayer.Base;

namespace QLKS.DataLayer.ManagerObjects
{
    public partial interface ITinhTrangManager : IManagerBase<TinhTrang, int>
    {
		// Get Methods
		TinhTrang GetByTenTinhTrang(System.String tenTinhTrang);
    }

    partial class TinhTrangManager : ManagerBase<TinhTrang, int>, ITinhTrangManager
    {
		#region Constructors
		
		public TinhTrangManager() : base()
        {
        }
        public TinhTrangManager(INHibernateSession session) : base(session)
        {
        }
		
		#endregion
		
        #region Get Methods

		
		public TinhTrang GetByTenTinhTrang(System.String tenTinhTrang)
        {
            ICriteria criteria = Session.GetISession().CreateCriteria(typeof(TinhTrang));
			
			
			criteria.Add(NHibernate.Criterion.Expression.Eq("TenTinhTrang", tenTinhTrang));
			
			IList<TinhTrang> result = criteria.List<TinhTrang>();
			return (result.Count > 0) ? result[0] : null;
        }
		
		#endregion
    }
}